<?php $this->load->view('partial/head'); ?>

<h2><?= $mode . " PETUGAS" ?></h2>

<form method="post" action="<?= base_url()."index.php/admin/save_petugas" ?>">
	<input type="hidden" name="mode" value="<?= $mode ?>" />
	<?php if($mode == 'EDIT'){ ?>
		<input type="hidden" name="id_petugas" value="<?= $detail['id_petugas'] ?>" />
	<?php } ?>
	
	<table cellpadding="10">
		<tr>
			<td>Nama</td>
			<td><input name="nama" size="50" value="<?=($mode == 'EDIT' ? $detail['nama'] : '')?>" /></td>
		</tr>
		<tr>
			<td>No. Telfon</td>
			<td><input name="no_telp" value="<?=($mode == 'EDIT' ? $detail['no_telp'] : '')?>" /></td>
		</tr>
		<tr>
			<td>Tanggal Lahir</td>
			<td><input name="tgl_lahir" size="20" placeholder="yyyy-mm-dd" value="<?=($mode == 'EDIT' ? $detail['tgl_lahir'] : '')?>" /></td>
		</tr>
		<tr>
			<td>Alamat</td>
			<td><textarea name="alamat"><?=($mode == 'EDIT' ? $detail['alamat'] : '')?></textarea></td>
		</tr>
		<tr>
			<td>Pendidikan Terakhir</td>
			<td><select name="pendidikan_terakhir">
					<option value="">- Pilih Tk. Pendidikan -</option>
					<?php foreach($pendidikan as $key=>$pend){ ?>
						<option value="<?=$key?>" <?=($mode == 'EDIT' ? ($key == $detail['pendidikan_terakhir'] ? 'selected' : '') : '')?>><?=$pend?></option>
					<?php } ?>
				</select>
			</td>
		</tr>
		<tr>
			<td>Role</td>
			<td><select name="role">
					<option value="">- Pilih Role -</option>
					<?php foreach($role as $key_r=>$role){ ?>
						<option value="<?=$key_r?>" <?=($mode == 'EDIT' ? ($key_r == $detail['role'] ? 'selected' : '') : '')?>><?=$role?></option>
					<?php } ?>
				</select>
			</td>
		</tr>
		<tr>
			<td colspan="2"></td>
		</tr>
		<tr>
			<td colspan="2"><h4>Akun Login</h4></td>
		</tr>
		<tr>
			<td>Username</td>
			<td><input name="username" size="50" value="<?=($mode == 'EDIT' ? $detail['username'] : '')?>" /></td>
		</tr>
		<tr>
			<td>Password</td>
			<td>
				<input type="password" name="password" size="50" /> 
				<?php if($mode == 'EDIT'){ ?> <font color="red">*Jika tidak diubah, biarkan kosong</font><?php } ?>
			</td>
		</tr>
		<tr>
			<td></td>
			<td>
				<a href="<?= base_url()."index.php/admin" ?>"><input type="button" value="Kembali" /></a>
				<input type="submit" value="Simpan" />
			</td>
		</tr>
	</table>
</form>